package com.example.exchangeapp.zjs;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import com.example.exchangeapp.R;
import android.content.Intent;
import android.os.Handler;
import android.widget.ImageView;

import com.example.exchangeapp.MainActivity;

public class SplashActivity extends AppCompatActivity {
    // 设置延时时间（以毫秒为单位）
    private static final int SPLASH_DISPLAY_LENGTH = 2000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        ImageView splashImageView = findViewById(R.id.splashImageView);
        // 设置启动图片资源
        splashImageView.setImageResource(R.drawable.launch_screen); // 替换为你的启动图片资源

        // 延时后跳转到主界面
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                // 启动应用的主界面
                Intent intent = new Intent(SplashActivity.this, MainActivity.class);
                startActivity(intent);
                finish(); // 结束启动活动
            }
        }, SPLASH_DISPLAY_LENGTH);
    }

}